from typing import List
import matplotlib.pyplot as plt
from Clustering import Clustering


def draw_clustering(clu: List[Clustering]) -> None:
    '''
    绘制聚类散点图
    '''
    color = ['or', 'ob', 'og', 'ok', 'oy', 'ow']     
    centroid = ['dr', 'db', 'dg', 'dk', 'dy', 'dw']
    for i,c in enumerate(clu):
        # 样本均值点
        plt.plot(c.m[0], c.m[1], centroid[i], markersize = 12)  
        for s in c.samples:
            # 每个样本点
            plt.plot(s[0], s[1], color[i])    
    plt.show()


def draw_curve(x_label: str, y_label: str, x: List ,y: List) -> None:
    '''
    绘制二维曲线图
    '''
    plt.plot(x, y)
    plt.xlabel(x_label)
    plt.ylabel(y_label)
    plt.show()
